<template>
  <div class="shopcar-container">
    <div class="goods-list">
      <!--列表-->
      <div class="mui-card" v-for="(item,index) in tableData" :key="item.id">
        <div class="mui-card-content">
          <div class="mui-card-content-inner">
            <img :src="item.pic_url">
            <div class="info">
              <h2>订单号:{{item.order_sn}}</h2>
              <h2>商品名称:{{item.goods_name}}</h2>
              <h2>数量:{{item.number}}</h2>
              <p>
                <span class="price">总金额:￥{{item.price}}</span>
                <!-- <numbox :count="item.number" :id="item.id"></numbox><br> -->
                <br>
                <a @click.prevent="remove(item.id, index)">删除订单</a>
              </p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tableData: []
    };
  },
  created() {
    this.getUser();
  },
  methods: {
       remove(id,i) {
      this.tableData.splice(i,1)
      this.$store.commit('removeCar',id)
    },
    selectedChange(id,val) {
      var sel = { id:id, selected:val }
      this.$store.commit('updateSelected',sel)
    },
    getUser() {
      var $this = this;
      this.axios({
        method: "GET",
        url: "http://localhost:9999/market/ecOrder/xujiabao/orderlist",
        params:{
          pageNo: 1,
          pageSize: 10,
          userId:localStorage.getItem('userId'),
          orderStatus:this.$route.params.status,
        }
      }).then(function(res) {
        $this.tableData = res.data.obj.list;
        console.log("sss{}",res.data.obj.list);
      });
    }
  }
};
</script>

<style scoped lang="scss">
.shopcar-container {
  background-color: #eee;
  overflow: hidden;
  .goods-list {
    .mui-card-content-inner {
      display: flex;
      align-items: center;
    }
    img {
      width: 120px;
      height: 120px;
    }
    h2 {
      font-size: 13px;
    }
    .info {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      .price {
        color: red;
        font-weight: bold;
      }
    }
  }
  .jiesuan {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .red {
    color:red;
  }
}

</style>
